package com.homedo.odin.solution.util;

import com.homedo.odin.solution.contract.mng.SpecificationEditPriReq;
import com.homedo.odin.solution.enumcode.basic.FromTypeEnum;
import com.homedo.odin.solution.enumcode.specification.SpecificationStatus;
import com.homedo.odin.solution.enumcode.specification.SpecificationStatusEnum;
import com.homedo.odin.solution.model.dto.SpecificationListPriResponseBean;
import com.homedo.odin.solution.model.entity.Specification;

public class SpecificationBeansConvertUtil {

    public static void convert(Specification specification, SpecificationListPriResponseBean specificationResponse) {
        if (specification == null || specificationResponse == null) {
            return;
        }
        specificationResponse.setSpecificationId(specification.getSpecificationId());
        specificationResponse.setSpecificationIdStr(specification.getSpecificationId().toString());
        specificationResponse.setSpecificationName(specification.getSpecificationName());
        specificationResponse.setUserId(specification.getUserId());
        specificationResponse.setUserName(specification.getUserName());
        specificationResponse.setFirstClassify(specification.getFirstClassify());
        specificationResponse.setSecondClassify(specification.getSecondClassify());
        specificationResponse.setFormType(specification.getFormType());
        specificationResponse.setFormTypeStr(FromTypeEnum.getExistDisplayValue(specification.getFormType()));
        specificationResponse.setCharges(specification.getCharges());
        specificationResponse.setSpecificationStatus(specification.getSpecificationStatus());
        specificationResponse.setSpecificationStatusStr(
                SpecificationStatusEnum.getExistDisplayValue(specification.getSpecificationStatus()));
        specificationResponse.setStatus(specification.getStatus());
        specificationResponse.setStatusStr(SpecificationStatus.getExistDisplayValue(specification.getStatus()));
        specificationResponse.setShelveTime(specification.getShelveTime());
        specificationResponse.setLastModifiedTime(specification.getLastModifiedTime());
    }

    public static void convert(Specification specification,
            SpecificationEditPriReq specificationEditBean) {
        if (specification == null || specificationEditBean == null) {
            return;
        }
        specification.setSpecificationId(specificationEditBean.getSpecificationId());
        specification.setAttachment(specificationEditBean.getAttachment());
        specification.setAuthor(specificationEditBean.getAuthor());
        specification.setCharges(specificationEditBean.getCharges());
        specification.setCode(specificationEditBean.getCode());
        specification.setFirstClassify(specificationEditBean.getFirstClassify());
        specification.setImplementData(specificationEditBean.getImplementData());
        specification.setIntroduction(specificationEditBean.getIntroduction());
        specification.setMainEditor(specificationEditBean.getMainEditor());
        specification.setMatchPic(specificationEditBean.getMatchPic());
        specification.setOldCode(specificationEditBean.getOldCode());
        specification.setPublishDate(specificationEditBean.getPublishDate());
        specification.setPublishDept(specificationEditBean.getPublishDept());
        specification.setSecondaryEditor(specificationEditBean.getSecondaryEditor());
        specification.setSecondClassify(specificationEditBean.getSecondClassify());
        specification.setSpecificationName(specificationEditBean.getSpecificationName());
        specification.setSpecificationStatus(specificationEditBean.getSpecificationStatus());
        specification.setZone(specificationEditBean.getZone());
        specification.setUserName(specificationEditBean.getUserName());
    }

}
